package com.itheima.io;

import java.io.*;

public class Demo3 {
    public static void main(String[] args) throws IOException {

        long start = System.currentTimeMillis();
        //method1();
        //method2();
        //method3();
        //method4();
        long end = System.currentTimeMillis();
        System.out.println(end-start);
    }

    public static void method4() throws IOException {
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("E:\\EveryDay\\JavaSE\\day12_IO流01\\资料\\素材\\嘿嘿嘿.avi"));
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("day12_file&io\\a.avi"));
        byte[] bytes = new byte[1024];
        int len;
        while((len = bis.read(bytes)) != -1){
            bos.write(bytes,0,len);
        }
        bis.close();
        bos.close();
    }

    private static void method3() throws IOException {
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("E:\\EveryDay\\JavaSE\\day12_IO流01\\资料\\素材\\嘿嘿嘿.avi"));
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("day12_file&io\\a.avi"));
        int b;
        while((b = bis.read()) != -1){
            bos.write(b);
        }
        bis.close();
        bos.close();
    }

    public static void method2() throws IOException {
        FileInputStream fis = new FileInputStream("E:\\EveryDay\\JavaSE\\day12_IO流01\\资料\\素材\\嘿嘿嘿.avi");
        FileOutputStream fos = new FileOutputStream("day12_file&io\\a.avi");
        byte[] bytes = new byte[1024];
        int len;
        while((len = fis.read(bytes)) != -1){
            fos.write(bytes,0,len);
        }
        fis.close();
        fos.close();
    }

    public static void method1() throws IOException {
        FileInputStream fis = new FileInputStream("E:\\EveryDay\\JavaSE\\day12_IO流01\\资料\\素材\\嘿嘿嘿.avi");
        FileOutputStream fos = new FileOutputStream("day12_file&io\\a.avi");
        int b;
        while((b = fis.read())!=-1){
            fos.write(b);
        }
        fis.close();
        fos.close();
    }
}
